// 商品详情的请求

import type { ProducTItem } from "@/types/global"
import { http } from "@/utils/https"


/**
 *
 * @param id 商品的id
 * @returns
 */
export const getGoodsByIdAPI = (id: string) => {
  return http<ProducTItem[]>({
    method: 'GET',
    url: `/commodity/prodcut_Id?id=${id}`,
    data: {
      id
    }
  })
}

/**
 * @param classNumber 商品的类编号
 */
export const getGoodsByClassNumber = async (classNumber: string) => {
  return (await http<[ProducTItem]>({
    method: 'GET',
    url: `/commodity/class?class=${classNumber}`,
  }).then(res => { return res })).data
}


/**
 * @param keywords 商品名称关键词
 */
export const getGoodsListByName = async (keywords: string) => {
  return (await http<ProducTItem[]>({
    method: 'GET',
    url: `/commodity/product_Name?name=${keywords}`,
  })).data
}
